package com.ruoyi.serviceItem.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.serviceItem.domain.WithdrawalRecord;
import com.ruoyi.serviceItem.service.WithdrawalRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/withdrawalRecord")
public class WithdrawalRecordController {
    @Autowired
    private WithdrawalRecordService withdrawalRecordService;

    @GetMapping("/list")
    public R listWithdrawalRecord() {
        return R.ok(withdrawalRecordService.getAllWithdrawalRecord());
    }

    @PostMapping("/apply")
    public AjaxResult apply(@Validated @RequestBody WithdrawalRecord withdrawalRecord) {
        return withdrawalRecordService.applyWithdrawal(withdrawalRecord);
    }
}
